package com.example.steeringwheelseekbar


import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController

@Composable
fun ComposeActivity(navController: NavController) {
    Column {
        var angle by remember { mutableStateOf("0") }
        SteerWheelBar(backgroundId = R.drawable.ic_launcher_background,
            clockwiseLimitAngle = 540,
            counterclockwiseLimitAngle = -540,
            listener = {
                angle = it.toString()
            })
        Text(
            text = "旋转角度",
            fontSize = 30.sp,
            modifier = Modifier.align(alignment = Alignment.CenterHorizontally)
        )
        Text(
            text = angle,
            fontSize = 30.sp,
            modifier = Modifier.align(alignment = Alignment.CenterHorizontally)
        )
        Spacer(modifier = Modifier.height(200.dp))
        Button(
            modifier = Modifier.align(alignment = Alignment.CenterHorizontally),
            onClick = { navController.navigate(RouteConfig.ROUTE_VIEW_ACTIVITY) }) {
            Text(text = "跳转至view实现方法", fontSize = 30.sp)
        }
    }
}
